package com.wzh.loveEmail.scheduled;


import cn.hutool.core.date.DateTime;
import com.wzh.loveEmail.service.Impl.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * 定时调度，发送邮件
 *
 * @author wzh
 */

@Service
public class scheduledTasks {

    @Autowired
    private MailService mailService;
    @Scheduled(cron = "${love.cron}")
    public void sendDailyEmail() {
        String to = "ol1617036662@outlook.com,ol1075392006@outlook.com";
        DateTime now = new DateTime();
        mailService.sendHtmlMailMessage(to, now.month() + "月" + now.dayOfMonth() + "日" + "早安推送", mailService.getHtml());
    }
}
